package com.moco.launcher.fragment;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.support.v4.app.Fragment;

import com.moco.launcher.R;
import com.moco.launcher.listener.FragmentChangeListener;
import com.moco.launcher.listener.FragmentListener;

public class BaseFragment extends Fragment {

	protected Context mContext;
	protected FragmentListener ml = null;
	private FragmentChangeListener mFragmentChangeListener = null;
	protected List<Integer> ids = new ArrayList<Integer>();
	
	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);
		mContext = activity;
		
		ids.add(R.drawable.category_bg_1);
		ids.add(R.drawable.category_bg_2);
		ids.add(R.drawable.category_bg_3);
		ids.add(R.drawable.category_bg_4);
	}

	public Context getContext() {
		return mContext;
	}

	public void registerCallback(FragmentChangeListener listener) {
		mFragmentChangeListener = listener;
	}

	public void nextFragment() {
		if (mFragmentChangeListener != null)
			mFragmentChangeListener.nextFragment();
	}

	public void prevFragment() {
		if (mFragmentChangeListener != null)
			mFragmentChangeListener.prevFragment();
	}

	public void registerCallback(FragmentListener l) {
		ml = l;
	}

}
